package com.haizhi.crm.tag.model;

import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.util.Arrays;
import java.util.LinkedHashSet;
import java.util.Map;
import java.util.Set;

/**
 * Created by chengmo on 2018/5/18.
 */
@Data
public class TagReq {
    private String graph;

    // filter
    @ApiModelProperty(value = "企业实体ID列表" )
    private Set<String> objectKeys = new LinkedHashSet<>();
    @ApiModelProperty(value = "标签ID列表" )
    private Set<Long> tagIds = new LinkedHashSet<>();

    @ApiModelProperty(value = "标签分类ID" )
    private long tagCategoryId;

    @ApiModelProperty(value = "标签ID" )
    private long tagId;

    @ApiModelProperty(value = "标签名称" )
    private String tagName;

    @ApiModelProperty(value = "标签描述" )
    private String tagDesc;

    @ApiModelProperty(value = "标签分组" )
    private String tagGroup;

    @ApiModelProperty(value = "标签状态" )
    private String tagStatus;

    @ApiModelProperty(value = "上架时间" )
    private String upTime;

    @ApiModelProperty(value = "标签规则" )
    private String rule;

    @ApiModelProperty(value = "标签逻辑参数" )
    private Map<String, Parameter> ruleParams;
    private String status;

    @Data
    public static class Parameter {
        private long id;
        private String type;
        private String name;
        private String reference;
        private String value;
    }

    public void addObjectKeys(String... objectKeys) {
        this.objectKeys.addAll(Arrays.asList(objectKeys));
    }

    public void addTagIds(Long... tagIds) {
        this.tagIds.addAll(Arrays.asList(tagIds));
    }
}
